package com.controller;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id ="2021000119641942";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDIjvKmMQjrNTz4919qhZSzV44VJWGxqihngzyegLYVjUX/mWWTAdjP0WK2L+7M2XXROBpgyp0P2AIuaInsHpfTEfjP4tHGxNHtgeT/ru6IzV/i1uKur29BDyEK6eodPBwflvL0KG8hWAYcDcqj0cNqH6DG+/KOPP1S3HGxlCkiOiSrh0JLQjLue5nZVwMscGH482mQrM+Sqb8mgMFKIY1pD5mgcyVBucLo1AJgIE5leOCNd9OaWxM/HuBZcM5+2fquRiDzDXbuXRD7B51kmtOF2uEgvhGxw+SNIQt/eMuLXJOAvARz/cLpQNMaxD0u0qR2V19tvAoEK1X/kCoAKOvBAgMBAAECggEBALCzaUxNVYtNy5ua74E9kgb0tCUjW1CaF6Ejumv4APU6FBsffqOn8+sdkvfrgV0Ql0IvSOZQfVLxQPK8fg//4EpBwlL+h062KDM2x5kR+e2j7MBCDVRVExNiDf28m90IEcsvRn0hhs/86t0atZfh/2bn2NKYNltlltfDi5QmcptIx7OnPDGqjz3L23YXcNmDj4iprWvOACF15WFHencBsD2oMp1FCEkak/iAlhbTAdldlC/Xu2auHsfBDrGgFrxWrL1wKKxkMyKz5KhgQkApsgeEBLFkEFrRxQt6E9BYH0NZJyi0G9MzqcDo6EDvWLHuZ+NFA4zMsIb8I9cf1IZ1/UUCgYEA+l8XAzFz1nwsOGCNm06J3WUwrL0WsthLuoAWACAlcQeF3EGnFlFTiJik8XW75oHs9LtftVUeZQbGlI9Id+fiGrC04gSpxJQMkDds11muQbmOUDytOUBZg+vg/Ni7LhCztubwO4eaye3kisS2VpxbtmMiNYyem/QwxChI4/K8MrMCgYEAzREt6oxYNxZmuzijNenp5ocMdF2+fBsV/+aiPxtctXeKPnPGJDg96a3b1gkiYdlBGhQzDR1039CXOXZuHxIFUTgwUpU3mQz7z5i5J3t2UgLSvAF4b/4Y5uZtUGUrC/rZwxF/VGTYWiQ40mzsrnEOmFb1M3KnyHuGoKuNJgpmEbsCgYArNSnVhT1GcJt5B0Co4r7sFEB4LxGxv54iC2TAlMuhW/j/79yT/2j5E86zVOwedaGdApEbzBq4uJignrGU79GXZZNxxfg+UoZwhQAlkfZ+pTUoJ7CFRtOr7pMfT4/N/VfmYqhmvZo66vEb+aK2A7nYGfeXYjMlGtknoQQjQoqz/QKBgQDAmETmh18GhdyAM8ZdiU4rO2UAGVcgmhPEXmi9GkatDBNjajqKo+PKB4Zzc+q9uVyCULxNsf+lgPO2fTsZpUQnLr17ojcwYFhTdd1XboYGqi4fcsYZcK0Ulw/NtOaD/tnscg+DRJ9JscFIKBL2FqqdevYZlrJsAU/EsLoFIzkPpwKBgQCNH+WqGYxPKN051fZXPNh5F9ERZkjURy5hDhrnyewqP0na3cCDVywglM/6SxSvv09NztvSmJG0ZgVUFuzwyelovEkaFrMa15s38fbAk0OxpLtEEjcLroR1Ma/JMIStekfeKwJ9FhoXrPx4j4aPUqmMn2MWBg5+559ik1EYAm5fbA==";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyY5z15amvQwZakS+ZnI0bqwFGbV88zRxXeMGx94QQFDtRAwptvCXHu3yYuNm+M5rdPMpEtym/Ao8dJB3CL67okbISki3Ww46LrA5o8o0E+Qfd0KdWn9Q+XoSbUMcNPgm0kPKC4key14IARmx3+bRTxZRsD8v9fAJNP+HNvSkNBFCSKiDW3tQF7lueMabqSGL3b4+eGabkr6/KjftLrPeLE+ah7IValswAm3Kx28bm24SmxfjnvdByL1fVQQUqBBuVBJNRnRPJvBuS76eiN5JpPZI8fs8lcUVrPGDjvgc4oZH9yHi6pEU+aqYZGon9zo0ZsZKbFs36c1+406gpeb71QIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	/**
	 * 支付成功返回的页面
	 */
	public static String return_url = "http://localhost:8080/book/goods/payOk";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

